package cn.xiaobai.core.mapper;

import cn.xiaobai.core.domain.config.ToolInfo;
import cn.xiaobai.core.domain.dto.ToolInfoDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @Author yangdaji
 * @Date 2023/12/11
 * @PackageName cn.xiaobai.core.mapper
 * @ClassName DataToDTOMapper
 */
@Mapper
public interface DataToDTOMapper {

    DataToDTOMapper mapper = Mappers.getMapper(DataToDTOMapper.class);


    @Mappings({
            @Mapping(source = "toolName", target = "name"),
            @Mapping(source = "jsonNode", target = "config"),
            @Mapping(source = "toolState", target = "state"),
    })
    ToolInfoDTO convertToToolInfoDto(ToolInfo toolInfo);

    @Mappings({
            @Mapping(source = "toolName", target = "name"),
            @Mapping(source = "jsonNode", target = "config"),
            @Mapping(source = "toolState", target = "state"),
    })
    List<ToolInfoDTO> convertToAllToolInfoDto(List<ToolInfo> toolInfos);

}
